package com.ctgu.utils;

import java.util.regex.Pattern;

/**
 * @author nepture
 */
public class RegexUtils {

    private static final String TEL_REGEX = "^(13\\d|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18\\d|19[0-35-9])\\d{8}$";
    private static final String PASSWORD_REGEX = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[~!@&%#_])[a-zA-Z\\d~!@&%#_]{8,16}$";

    public static boolean checkTel(String telephone) {
        return telephone.length() == 11 && Pattern.matches(TEL_REGEX, telephone);
    }

    public static boolean checkPassword(String password) {
        return password.length() >= 8 && Pattern.matches(PASSWORD_REGEX, password);
    }
}
